const app = getApp()
Component({
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#ee5f42",
    list: [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "iconPath": "/image/tabbar/home.png",
        "selectedIconPath": "/image/tabbar/home-active.png"
      },
      {
        "pagePath": "pages/service/service",
        "text": "",
        "iconPath": "/image/tabbar/service.png",
        "selectedIconPath": "/image/tabbar/service-active.png"
      },
      {
        "pagePath": "pages/my/my",
        "text": "个人中心",
        "iconPath": "/image/tabbar/my.png",
        "selectedIconPath": "/image/tabbar/my-active.png"
      }
    ],
    centerImg: "/image/tabbar/gateway.png",
  },
  
  attached() {
      // 如果中间凸起跳转 tabbar 页面，则把下面注释打开
      if (this.data.selected == 2) {
          this.setData({
              centerImg: '/image/images/myjy.png'
          })
      } else {
      }
  },

  methods: {
    // 切换 tab 事件
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const path = data.path;
      const index = data.index;
      wx.switchTab({
          url: "/"+path,
        });
    },
    
  },
})